<?php

//防止恶意调用
if (!defined('IN_MOD'))
{
    die('Hacking attempt');
}

// 获取商品订购功能信息
if($configinfo['shopok'] == 1)
{
	// 获取当前会员等级
	if($configmember['rank_id'] > 0)
	{
		$modulewhere=array();
		$modulewhere["tablename"]="fastxcms_user_rank";
		$modulewhere["dataid"]=$configmember['rank_id'];
		$modulewhere["dataidname"]="id";
		$rankinfo=modulepara("datainfo",$modulewhere);
		$rankinfo['discount'] = $rankinfo['discount'] / 10;
		
	}else{
		$rankinfo['id'] = 0;
		$rankinfo['name'] = "普通会员";
		$rankinfo['discount'] = 0;
	}
	$configmember['rankinfo'] = $rankinfo;
	
	// 获取当前会员优惠券列表
	$modulewhere=array();
	$modulewhere['tablename'] = "fastxcms_user_coupon";
	$modulewhere['arrayclass'] = $configmember['id'];
	$modulewhere['bigclassname'] = "userid";
	$modulewhere['limit'] = "all";
	$modulewhere['langallok'] = 1;
	$modulewhere['order'] = "default";
	$couponlist = configmodule($modulewhere);
	$couponlistuse = array();
	$couponlistused = array();
	$couponlistexpired = array();
	foreach($couponlist as $key=>$val)
	{
		// 去使用URL
		if($val['goodsids'])
		{
			$val['url'] = "/list3-cn.html?goodsids=".$val['goodsids'];
		}else{
			$val['url'] = "/";	
		}
		
		// 可使用优惠券
		if($val['status'] == 0 && $val['endtime'] >= time())
		{
			$couponlistuse[$val['yhjid']] = $val;
		}
		
		// 已使用优惠券
		if($val['status'] == 1)
		{
			$couponlistused[$val['yhjid']] = $val;
		}
		
		// 已过期优惠券
		if($val['status'] == 0 && $val['endtime'] < time())
		{
			$couponlistexpired[$val['yhjid']] = $val;
		}
	}
	$configmember['couponlist'] = $couponlistuse;
	$configmember['couponlistused'] = $couponlistused;
	$configmember['couponlistexpired'] = $couponlistexpired;
	
	// 登录后的购物车数据
	$configinfo['shopcarthtml'] = getshopcarthtml();// 获取商品购物车HTML
	
	// 商品详情页获取订购信息
	if($configinfo['moduleid'] == 3 && $configinfo['detailmodule'] == 1)
	{
		// 登录后的商品活动列表
		$configinfo['shopactivity'] = getshopactivitylist();// 获取栏目商品活动列表
	}
}
?>